<?php
 /******************************************************************************
 *   GunCMS is an avid supporter of open source software. This is the appropriate 
 *   option if you are creating an open source application with a license 
 *   compatible with the GNU GPL license v3.
 *   For details http://www.gnu.org/licenses/gpl.html
 *   DO NOT USE FOR COMMERCIAL WITHOUT PERMISSION
 *
 * GunCMS Version 1.0.3
 * Copyright(c) 2009-2010, T & L GdbR
 * info@guncms.de
 * 
 * http://www.guncms.de
 ********************************************************************************/
class BgcmsLogfiles extends BgcmsProcess{
	
	var $db;
 	var $smarty;
 		
	public function __construct($db, $smarty) {
		$this->db = $db;
		$this->smarty = $smarty;
	}
		
	public function __destruct() {
		//
	}
	
	public function process() {
		$this->show_log_file();
		$this->Run();
	}
	
	/*list user agent data*/	
	public function show_log_file() {
		
		if (!isset($_SESSION['user_name'])) {
			
			if(BgcmsLogfilesBean::get_user_agent($this->db)!= "") {
				 BgcmsLogfilesBean::update_user_agent($this->db, "y");
			} else {
				BgcmsLogfilesBean::create_user_agent($this->db);
			}
		}
		
//		if (date('H') == 00) { 
//			@mysql_query("TRUNCATE TABLE " . TBL_ADMIN_USER_ONLINE . ""); 
//		}
//		
//		BgcmsLogfilesBean::delete_user_agent($this->db);
		
		$userList = BgcmsLogfilesBean::get_logged_user($this->db);
		$this->smarty->assign("USER_ONLINE_LIST", $userList);
	}
}

?>